package com.atguigu.gmall.client;

import com.atguigu.gmall.client.impl.PaymentDegradeFeignClient;
import com.atguigu.gmall.model.enums.PaymentType;
import com.atguigu.gmall.model.payment.PaymentInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author mgx
 * @create 2024-09-18 13:56
 * @Description
 */
@FeignClient(value = "service-payment", fallback = PaymentDegradeFeignClient.class)
public interface PaymentFeignClient {
    /**
     * 查询支付记录信息
     *
     * @param outTradeNo
     * @return
     */
    @GetMapping("/api/payment/alipay/getPaymentInfo/{outTradeNo}")
    @ResponseBody
    PaymentInfo getPaymentInfo(@PathVariable String outTradeNo);


    /**
     * http://localhost:8205/api/payment/alipay/closePay/25
     * 关闭支付宝交易记录
     *
     * @param orderId 订单id
     * @return 是否关闭成功
     */
    @GetMapping("/api/payment/alipay/closePay/{orderId}")
    @ResponseBody
    Boolean closePay(@PathVariable("orderId") Long orderId);


    /**
     * http://localhost:8205/api/payment/alipay/checkPayment/30
     * 查询支付宝交易记录
     *
     * @param orderId 订单id
     * @return 是否存在
     */
    @GetMapping("/api/payment/alipay/checkPayment/{orderId}")
    @ResponseBody
    Boolean checkPayment(@PathVariable("orderId") Long orderId);
}
